import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		System.out.println("Vvedite razmernost massiva");
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int mass[] = new int [n];
		System.out.println("Vvedite elementy massiva");
		for (int i = 0;i<mass.length;i++)
		{
			mass[i]=sc.nextInt();
		}
		
        int max = Integer.MIN_VALUE,min = Integer.MAX_VALUE;
        for (int i = 0;i<n;i++)
        { 
        	if (mass[i]>max) max=mass[i];
        } 
        for (int j = 0;j<n;j++)
        {
        	if (mass[j]<min) min=mass[j];
        }
        System.out.println("Max = "+max);
        
        System.out.println("Min = "+min);
        
	}

}
 